The present invention relates generally to tracking process creation during execution of a software application. More particularly, the present invention relates to monitoring the creation and destruction of child processes and grand-child processes of an executing application.
A conventional computer system 100 is illustrated in FIG. 1, and has several hardware components, including a processor 110 such as a central processing unit (CPU), a memory 120 such as RAM, and a non-volatile storage medium 130, all in communication with one another. Other hardware components not shown include disk drives, network devices, and other hardware devices known to those skilled in the art.
Conventional computer system 100 further includes software programs which may be stored on and executed using the several hardware components 110, 120, 130. Specifically, the software in computer system 100 includes application 150, which resides in storage medium 130, operating system 160, stored in memory 120, and possibly other applications or programs stored in storage medium 130 and memory 120. When the computer is active, application 150 may be found in memory 120. When the computer is off, operating system 160 may be found in storage medium 130. Thus, operating system 160 may be stored in various locations, as should be understood by those skilled in the art.
Application 150 and operating system 160 interact with one another and possibly other software in system 100 to provide data access to a user and to control other hardware and software in system 100 as designated by the user. The user of computer system 100 executes application 150 by instructing operating system 160 to execute, or xe2x80x9crun,xe2x80x9d application 150. Operating system 160 then executes the requested application 150, and possibly other programs interleaved with application 150, using memory 120, processor 110, and other devices available to computer system 100.
Operating system 160 may be any conventional operating system known to those skilled in the art. Popular conventional operating systems used in personal computers include 32-bit Windows (xe2x80x9cWin32xe2x80x9d) operating systems such as those made by Microsoft Corp. These include Microsoft Windows NT, Windows 95 and Windows 98. Other conventional operating systems which may be used as operating system 160 include UNIX for use with workstations, and DOS for use with personal computers.
A Win32-based application running in the system is called a xe2x80x9cprocessxe2x80x9d in terms of the operating system. Each process consists of at least a single thread of execution to be run by the operating system. A thread is a unit of code that can get some operating time from the operating system to run concurrently with other units of code, and must be associated with a process.
Win32-based applications can take advantage of various techniques provided by Windows operating systems to facilitate the ability to run applications concurrently. One of these concurrency techniques is xe2x80x9cmulti-threading,xe2x80x9d in which portions of one or more processes, or xe2x80x9cthreadsxe2x80x9d, are separately and concurrently executable.
Executing two separate threads concurrently, however, is sometimes not particularly efficient. These inefficiencies arise where one executing application or process, the xe2x80x9cparentxe2x80x9d process, spawns another xe2x80x9cchildxe2x80x9d process, and particularly where the child process spawns grandchild processes. Such situations may present problems where the parent process is one of a series of processes or applications to be executed. For example, the parent process may terminate before one or more of its child processes or grandchild processes have terminated. If execution of some other application commences while the child processes of the terminated parent processes are still active, corruption may result in some computer systems, notwithstanding the multi-threading techniques provided by operating systems such as Windows 95.
FIG. 2 illustrates a series of applications stored for execution in a computer system, such as system 100 of FIG. 1. The series includes a first application 210, a second application 220, and a third application 230, each of which represents a stage of a larger installation process for installing a software program. Applications 210, 220, 230 may be stored on a storage medium 130 or memory 120, as shown in FIG. 1. The execution of applications 210, 220, 230 is governed by an operating system 240, which is stored in memory 120.
In FIG. 2, applications 210, 220, 230 are to be executed in sequence, as controlled by operating system 240. FIG. 2 is drawn at a time when execution of first application 210 has begun, and at a time when first application 210 has created child processes 250, 260. In addition, child process 260 has spawned child processes of its own, or xe2x80x9cgrand-childxe2x80x9d processes 270, 280.
In FIG. 2, the execution of first application 210 may terminate before child processes 250, 260, or grand-child processes 270, 280 have terminated. If the installation process does not wait for the executing child or grand-child processes to terminate, operating system 240 may initiate execution of second application 220, the next stage in installation. Execution of second application 220, or possibly some other application, while one or more child or grand-child processes of the first application 210 are still executing could cause corruption in the computer system in which the applications are used.
In Windows 95, the published Win32 API is supposed to delay the execution of other applications before child and processes of a parent application are terminated. Win32 API, however, often does not work correctly because Win32 API does not track the creation of grand-child processes of the parent application. Thus, using only Win32 API, the execution of other applications may commence before the child and, particularly, the grand-child processes of the parent have terminated. In sum, existing techniques fail to provide reliable tracking of the creation and destruction of child processes and grand-child processes during the execution of applications in a computer system.
The present invention relates generally to monitoring the creation and destruction of child and grand-child processes within an application executing in a computer system controlled by an operating system. A child process has a corresponding child process database structure, and the executing application has a corresponding application process database structure. A list is provided for storing existing child process database structures corresponding to child processes existing within the executing application.
According to one aspect of the present invention, when a new process is created during execution of the application, a new process database structure corresponding to the new process is retrieved. Using the new process database structure, a parent process database structure corresponding to a parent process of the new process is retrieved. The parent process database structure is compared with the application process database structure. If the parent process database structure is the same as the application process database structure, the new process is identified as an existing child process. If the new process is identified as the existing child process, the new process database structure is added to the list of existing child process database structures.
According to another aspect of the present invention, monitoring the creation and destruction of child processes within the application includes determining when a process is terminated during execution of the application. A terminated process database structure corresponding to the terminated process is retrieved. The terminated process database structure is compared with the existing child process database structures in the list. If the terminated process database structure is the same as one of the existing child process database structures, the terminated process is identified as a terminated child process. If the terminated process is identified as the terminated child process, the terminated process database structure is removed from the list of existing child process database structures.
According to another aspect, the present invention may be situated in a virtual device driver, which may reside between the operating system and an executing application or process. The virtual device driver may be stored in a storage medium in the computer system. The VxD interfaces with both the operating system and the executing application.
According to yet another aspect of the present invention, the list is checked periodically to determine if the list has any entries. If the list has no entries, it is safe to assume that the existing child process and, possibly, related grand-child processes, have exited and execution of the application is complete. Other applications in a series of applications, for example, during the installation of a software program, may then be executed with minimal risk of corruption due to concurrent execution of applications in the series.